<template>
  <a-card :body-style="{padding: '24px 32px'}" :bordered="false">
    <a-form @submit="handleSubmit" :form="form">
      <a-form-item
        label="$t('formBasicForm.bt')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
        <a-input
          v-decorator="[
            'name',
            {rules: [{ required: true, message: '{{ $t('formBasicForm.qsrbt') }}' }]}
          ]"
          name="name"
          placeholder="$t('formBasicForm.gmbqgmz')" />
      </a-form-item>
      <a-form-item
        label="$t('formBasicForm.qzrq')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
        <a-range-picker
          name="buildTime"
          style="width: 100%"
          v-decorator="[
            'buildTime',
            {rules: [{ required: true, message: '{{ $t('formBasicForm.qxzqzrq') }}' }]}
          ]" />
      </a-form-item>
      <a-form-item
        label="$t('formBasicForm.mbms')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
        <a-textarea
          rows="4"
          placeholder="$t('formBasicForm.qsrnjdxgzmb')"
          v-decorator="[
            'description',
            {rules: [{ required: true, message: '{{ $t('formBasicForm.qsrmbms') }}' }]}
          ]" />
      </a-form-item>
      <a-form-item
        label="$t('formBasicForm.hlbz')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
        <a-textarea
          rows="4"
          placeholder="$t('formBasicForm.qsrhlbz')"
          v-decorator="[
            'type',
            {rules: [{ required: true, message: '{{ $t('formBasicForm.qsrhlbz') }}' }]}
          ]" />
      </a-form-item>
      <a-form-item
        label="$t('formBasicForm.kh')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
        <a-input
          placeholder="$t('formBasicForm.qmsnfwdkhnbkhzj') @$t('formBasicForm.xm')／$t('formBasicForm.gh')"
          v-decorator="[
            'customer',
            {rules: [{ required: true, message: '{{ $t('formBasicForm.qmsnfwdkh') }}' }]}
          ]" />
      </a-form-item>
      <a-form-item
        label="$t('formBasicForm.ypr')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
        :required="false"
      >
        <a-input placeholder="$t('formBasicForm.qzj') @$t('formBasicForm.xm')／$t('formBasicForm.ghzdkyq') 5 $t('formBasicForm.r')" />
      </a-form-item>
      <a-form-item
        label="$t('formBasicForm.qz')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
        :required="false"
      >
        <a-input-number :min="0" :max="100" />
        <span> %</span>
      </a-form-item>
      <a-form-item
        label="$t('formBasicForm.mbgk')"
        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
        :required="false"
        help="{{ $t('formBasicForm.khyprmrbfx') }}"
      >
        <a-radio-group v-model="value">
          <a-radio :value="1">{{ $t('formBasicForm.gk') }}</a-radio>
          <a-radio :value="2">{{ $t('formBasicForm.bfgk') }}</a-radio>
          <a-radio :value="3">{{ $t('formBasicForm.bgk') }}</a-radio>
        </a-radio-group>
        <a-form-item>
          <a-select mode="multiple" v-if="value === 2">
            <a-select-option value="4">{{ $t('formBasicForm.tsy') }}</a-select-option>
            <a-select-option value="5">{{ $t('formBasicForm.tse') }}</a-select-option>
            <a-select-option value="6">{{ $t('formBasicForm.tss') }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-form-item>
      <a-form-item
        :wrapperCol="{ span: 24 }"
        style="text-align: center"
      >
        <a-button htmlType="submit" type="primary">{{ $t('formBasicForm.tj') }}</a-button>
        <a-button style="margin-left: 8px">{{ $t('formBasicForm.bc') }}</a-button>
      </a-form-item>
    </a-form>
  </a-card>
</template>

<script>
export default {
  name: 'BaseForm',
  data () {
    return {
      description: this.$t('formBasicForm.bdyyyxyhsjhyzxxjcbdcjysjxjsdbdcj'),
      value: 1,
      // form
      form: this.$form.createForm(this)

    }
  },
  methods: {

    // handler
    handleSubmit (e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          // eslint-disable-next-line no-console
          console.log('Received values of form: ', values)
        }
      })
    }
  }
}
</script>
